Socket
Socket
Sign inDemoInstall

redux-subspace

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-subspace

Create isolated subspaces of a Redux store


Version published
Weekly downloads
964
decreased by-14.77%
Maintainers
3
Weekly downloads
 
Created
Source

redux-subspace

npm version npm downloads License: BSD-3-Clause

This is a library to help build decoupled, componentized Redux apps that share a single global store. This is the core package of redux-subspace

Installation

npm install --save redux redux-subspace

Quick Start

import { createStore, combineReducers } from 'redux'
import { subspace, namespaced } from 'redux-subspace'
import { todoReducer, addTodo } from './todoApp'
import { counterReducer, increment, decrement } from './counterApp'

const rootReducer = combineReducers({
  todo: todoReducer
  counter1: namespaced('counter1')(counterReducer),
  counter2: namespaced('counter2')(counterReducer)
})

const store = createStore(rootReducer)

const todoStore = subspace((state) => state.todo)
const counter1Store = subspace((state) => state.counter1, 'counter1')
const counter2Store = subspace((state) => state.counter2, 'counter2')

todoStore.dispatch(addTodo('Use redux-subspace!'))
const todoState = todoStore.getState()

counter1Store.dispatch(increment())
const counter1State = counter1Store.getState()

counter2Store.dispatch(decrement())
const counter2State = counter2Store.getState()

const rootState = store.getState()

Documentation

The full documentation for Redux Subspace can be found here.

FAQs

Package last updated on 16 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc